#include "Core/Plugin/PluginManager.h"
#include "Core/Network/INetworkPlugin.h"
#include "Core/Profile/CodeProfile.h"
#include "PluginTest.h"

const char * PluginTest::GetName() const
{
	return "[CORE] Plugin Test";
}

Core::error PluginTest::Create()
{
	if(Failed(UnitTest::Create()))
		return Core::errFailed;

	return Core::errOK;
}

Core::error PluginTest::Destroy()
{
	if(Failed(UnitTest::Destroy()))
		return Core::errFailed;

	return Core::errOK;
}

Core::error PluginTest::Execute()
{
	PROFILE(GetName());

	Core::Network::INetworkPlugin * pPlugin = Core::Plugin::PluginManager::GetInstance().RegisterPlugin<Core::Network::INetworkPlugin>(Core::Plugin::Network, "Network");
	if (pPlugin == NULL)
	{
		return Core::errFailed;
	}
	
	Core::error e = Core::Plugin::PluginManager::GetInstance().UnregisterPlugin(Core::Plugin::Network);
	if (e != Core::errOK)
	{
		return Core::errFailed;
	}

	return Core::errOK;
}
